% Load the data from output/ests_formatlab.csv
alldata = readtable("ests_formatlab.csv");

Ns = [250,100,50];
outs = {'any_vadc','combat_death','noncom_death'};

results = zeros(9,2);
row = 1;
for i = 1:length(Ns)

	% Subset
	tmp = alldata(alldata.count >= Ns(i),:);

	for o = 1:length(outs)

		data = tmp(tmp.(append('var_',outs{o})) > 0.000001, :);

		% Run the test
		[teststat,pval,yfit,pfit] = testjfe(data.(outs{o}), data.months_dep, ones(size(data,1)), data.(append('var_',outs{o})), data.(append('covvar_months_dep_',outs{o})), data.var_months_dep, 1, 0.05, 0);

		Ns(i)
		outs{o}
		results(row,1) = teststat
		results(row,2) = pval	
		row = row + 1;	
	end
end
